#ifndef TASK_H
#define TASK_H

namespace bimar_scheduler_lib
{

typedef struct _STaskBind STaskBind;
struct _STaskBind
{
  gboolean parallelPrev;
  gboolean parallelNext;
};

typedef enum _EStatus EStatus;
enum _EStatus
{
  EStatus_Invalid = 0,
  EStatus_Ready,
  EStatus_Stopped,
  EStatus_Running,
  EStatus_Paused,
  EStatus_Aborted,
  EStatus_Done,
};

class CTask
{
public:
  CTask();

  /* parallel properties */
  void SetPropertyNextParallel(gboolean value = TRUE);
  void SetPropertyPrevParallel(gboolean value = TRUE);
  gboolean IsParallelPrev();
  gboolean IsParallelNext();

  /* status */
  void SetStatus(EStatus status) { m_status = status; }
  EStatus GetStatus() { return m_status; }

  /* control */
  virtual gboolean Ready() { SetStatus(EStatus_Ready); return TRUE; }
  virtual gboolean Run() { SetStatus(EStatus_Running); return TRUE; }
  virtual gboolean Stop() { SetStatus(EStatus_Stopped); return TRUE; }
  virtual gboolean Pause() { SetStatus(EStatus_Paused); return TRUE; }
  virtual gboolean Resume() { SetStatus(EStatus_Running); return TRUE; }
  virtual gboolean Abort() { SetStatus(EStatus_Aborted); return TRUE; }
  virtual gboolean Done() { SetStatus(EStatus_Done); return TRUE; }

protected:
  void InitBind();		//!< parallel info

protected:
  STaskBind m_bindInfo;	//!< parallel info
  EStatus m_status;		//!< status
};

}; /* namespace */

#endif // TASK_H
